package com.demo12;

import java.util.Iterator;
import java.util.LinkedList;

public class List1Demo {
    public static void main(String[] args) {
        LinkedList<String> linkedList = new LinkedList<>();

        linkedList.add("hello");
        linkedList.add("world");
        linkedList.add("javaEE");

        for (String s : linkedList) {
            System.out.println(s);
        }

        System.out.println("--------------------");
        Iterator<String> iterator = linkedList.iterator();
        while (iterator.hasNext()){
            String next = iterator.next();
            System.out.println(next);
        }
    }
}
